﻿var Ecatalog;
(function (Ecatalog) {
    /// <reference path="typings/jquery/jquery.d.ts" />
    /// <reference path="typings/knockout.mapping/knockout.mapping.d.ts" />
    (function (Api) {
        var GetComplectsParams = (function () {
            function GetComplectsParams() {
            }
            return GetComplectsParams;
        })();
        Api.GetComplectsParams = GetComplectsParams;

        var LocationDto = (function () {
            function LocationDto() {
            }
            return LocationDto;
        })();
        Api.LocationDto = LocationDto;

        var ComplectsDto = (function () {
            function ComplectsDto() {
            }
            return ComplectsDto;
        })();
        Api.ComplectsDto = ComplectsDto;

        var KitDto = (function () {
            function KitDto() {
            }
            return KitDto;
        })();
        Api.KitDto = KitDto;

        var ModelDto = (function () {
            function ModelDto() {
            }
            return ModelDto;
        })();
        Api.ModelDto = ModelDto;

        var StructuresDto = (function () {
            function StructuresDto() {
            }
            return StructuresDto;
        })();
        Api.StructuresDto = StructuresDto;

        var ColorsDto = (function () {
            function ColorsDto() {
            }
            return ColorsDto;
        })();
        Api.ColorsDto = ColorsDto;

        var SizeDto = (function () {
            function SizeDto() {
            }
            return SizeDto;
        })();
        Api.SizeDto = SizeDto;

        var DataLoader = (function () {
            function DataLoader(url, httpMethod) {
                this.load = function (data, success) {
                    var jsonData = data == null ? null : ko.mapping.toJSON(data);
                    var settings = {
                        url: url,
                        dataType: "json",
                        type: httpMethod,
                        data: jsonData,
                        contentType: "application/json; charset=utf-8",
                        error: function () {
                            alert('При запросе данных произошла ошибка');
                        },
                        beforeSend: function () {
                        },
                        success: function (data) {
                            success(data);
                        },
                        complete: function () {
                        }
                    };
                    jQuery.ajax(settings);
                };
            }
            return DataLoader;
        })();
        Api.DataLoader = DataLoader;

        var AsyncClient = (function () {
            function AsyncClient() {
                this.GetComplects = function (data, success) {
                    var dataLoader = new DataLoader("/base/GetComplectsJson", "Post");
                    dataLoader.load(data, function (result) {
                        success(result);
                    });
                };
            }
            AsyncClient.Current = new AsyncClient();
            return AsyncClient;
        })();
        Api.AsyncClient = AsyncClient;
    })(Ecatalog.Api || (Ecatalog.Api = {}));
    var Api = Ecatalog.Api;
})(Ecatalog || (Ecatalog = {}));
//# sourceMappingURL=ecatalog.api.js.map
